﻿@{
    Layout = "./_Layout.cshtml";

    MVC4Base.Models.PagingModel pagingModel = (MVC4Base.Models.PagingModel)ViewData["pagingModel"];

    List<MVC4Base.fnSYSCodeList_Result> mainCodeModel = (List<MVC4Base.fnSYSCodeList_Result>)ViewData["mainCodeModel"];

    MVC4Base.tbSYSCode sysCode = (MVC4Base.tbSYSCode)ViewData["sysCode"];
}

<!--타이틀, 네비게이터-->
<div class="sub_title">
    <h2>
        메인코드 관리</h2>
    <ul>
        <li class="navi_home"></li>
        <li>코드 관리</li>
        <li class="navi_on">메인코드 관리</li>
    </ul>
</div>
<!--//타이틀, 네비게이터-->

@using (Html.BeginForm("MainCodeList", "Admin", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { id = "searchForm" }))
{
    @Html.Hidden("titleYN", ViewData.Eval("titleYN"));
    <!--상단버튼영역,board.css-->
    <div class="top_btn">
        <div class="ri">
            <div class="btn_list">
                <a href="javascript:document.getElementById('searchForm').submit()">
                    <span>
                        
                        <img src="/Content/img/btn/btn_top_inquiry.gif" width="23" height="20" alt="검색" /></span>
                        <span>검색</span>
                </a>
            </div>
        </div>
    </div>
    <!--//상단버튼영역-->

    <!--조회조건 박스, board.css-->
    <table class="box" cellSpacing="0" cellMargin="0">
        <tr>
            <td class="box_t01">
            </td>
            <td class="box_t02">
            </td>
            <td class="box_t03">
            </td>
        </tr>
        <tr>
            <td class="box_le">
                &nbsp;
            </td>
            <td class="box_cen">
                <table class="box_cont">
                    <colgroup>
                        <col style="width:80px" />
                        <col />
                        <col />
                    </colgroup>
                    <tr>
                        <th>
                            @Html.Label("mainCode", "메인코드")
                        </th>
                        <td>
                            @Html.TextBox("mainCode", ViewData.Eval("mainCode"),
                            new
                            {
                                Class = "input_border",
                                id = "txtSearchValue",
                                onchange = "$('#hhdCurrentPageIndex').attr('value','1');",
                                maxlength = "20"
                            })
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
            </td>
            <td class="box_ri">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="box_f01">
            </td>
            <td class="box_f02">
            </td>
            <td class="box_f03">
            </td>
        </tr>
    </table>
    <!--//조회조건 박스-->

    <!-- 리스트영역 시작 -->
    <table id="tbList" class="list" cellSpacing="0" cellMargin="0">
        <colgroup>
@*            <col style="width:25px" />*@
            <col style="width:30px" />
            <col style="width:150px" />
            <!-- 메인코드 -->
            <col style="width:150px" />
            <!-- 코드명 -->
            <col style="width:70px" />
            <!-- 사용유무 -->
            <col style="width:70px" />
            <!-- 정렬순서 -->
            <col style="width:" />
            <!-- 설명 -->
        </colgroup>
        <thead>
            <tr>
@*                <th class="list_le">
                    <input onclick="$('input[name=chkCheck]').attr('checked', this.checked);" style="padding: 0;
                        margin-top: -2px;" type="checkbox" />
                </th>*@
                <th class="list_le">
                    No
                </th>
                <th>
                    메인코드
                </th>
                <th>
                    코드명
                </th>
                <th>
                    사용
                </th>
                <th>
                    정렬
                </th>
                <th>
                    설명
                </th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <td colspan="6">
                </td>
            </tr>
        </tfoot>
        <tbody>
            @if (pagingModel.TotalCount == 0)
            {
                    <tr>
                        <td colspan="7" class="list_le">
                            데이터가 없습니다.
                        </td>
                    </tr>
            }
            else
            {
                int iCount = 0;
                foreach (MVC4Base.fnSYSCodeList_Result row in mainCodeModel)
                {
                    iCount++;
                    
                    <tr style="cursor: pointer" onmousedown="WebControl.SelectedRow(this);"
                        onmouseover="WebControl.FocusRow(this, 'over');" onmouseout="WebControl.FocusRow(this, 'out');"
                        @if (iCount % 2 == 1)
                        {<text> class="tr_bg"</text>} isalternat="@(iCount % 2)">
@*                        <td class="list_le">
                            <input type="checkbox" name="chkCheck" style="padding: 0; margin-top: -2px;" />
                        </td>*@
                        <td class="list_le">
                            @row.RowNo
                        </td>
                        <td>
                            @row.MainCode
                        </td>
                        <td>
                            @row.CodeName
                        </td>
                        <td>
                            @row.UseYN
                        </td>
                        <td>
                            @row.SortOrder
                        </td>
                        <td>
                            @row.Description
                        </td>
                    </tr>
                }
            }


        </tbody>
    </table>
    <!-- 리스트 끝 -->
    @Html.Partial("_Paging")

    <!-- 데이타의 C,U,D 상태를 나타냅니다. -->
    <div style="position: fixed">
        @Html.Hidden("hhsStatus", "I")
    </div>
    <!-- 리스트영역 종료 -->

    <!-- 상세영역 시작 -->
    <h3>
        메인코드 상세보기</h3>
    <table id="htblDetail" class="sub_table" cellSpacing="0" cellMargin="0">
        <colgroup>
            <col style="width: 100px;" />
            <col  />
            <col style="width: 100px;" />
            <col style="width: 50px;" />
        </colgroup>
        <tr>
            <th class="list_le">
                @Html.Label("sysCode.MainCode", "메인코드")
            </th>
            <td>
                @Html.TextBox("sysCode.MainCode", sysCode.MainCode,
                            new { 
                                Class = "input_border",
                                maxlength = "20",
                                Readonly = (string.IsNullOrEmpty(sysCode.MainCode) ? "false" : "true")
                            })
            </td>
            <th>
                @Html.Label("sysCode.UseYN", "사용여부")
            </th>
            <td>
                @Html.RadioButton("sysCode.UseYN", "Y", sysCode.UseYN == "Y", new { id="UseYN_Y"})
                @Html.Label("UseYN_Y", "사용")
                @Html.RadioButton("sysCode.UseYN", "N", sysCode.UseYN == "N", new { id="UseYN_N"})
                @Html.Label("UseYN_N", "미사용")
            </td>
        </tr>
        <tr>
            <th class="list_le" >
                @Html.Label("sysCode.CodeName", "코드명")
            </th>
            <td>
                @Html.TextBox("sysCode.CodeName", sysCode.CodeName,
                new { 
                    Class = "input_border",
                    maxlength = "100"
                })
            </td>
            <th>
                @Html.Label("sysCode.SortOrder", "정렬순서")
            </th>
            <td>
                @Html.TextBox("sysCode.SortOrder", sysCode.SortOrder,
                new { 
                    Class = "input_border",
                    maxlength = "100"
                })
            </td>
        </tr>
        <tr>
            <th class="list_le" >
                @Html.Label("sysCode.Description", "설명")
            </th>
            <td colspan="3">
                @Html.TextBox("sysCode.Description", sysCode.Description,
                new { 
                    Class = "input_border",
                    maxlength = "3000"
                })
            </td>
        </tr>
    </table>
    <!-- 상세영역 종료 -->
    <!-- 버튼영역 시작 -->
    <!--리스트 하단버튼영역,board.css-->
    <div class="foot_btn">
        <div class="ri">
            <div class="btn">
                <a href="#" onclick="return false;"><span>
                    <img src="/Content/img/btn/btn_new.gif" width="30" height="30" alt="New" /></span><p>추가</p>
                </a>
            </div>
            <div class="btn">
                <a href="#" onclick="return false;">
                    <span>
                        <img src="/Content/img/btn/btn_save.gif" width="30" height="30" alt="Save" /></span><p>저장</p>
                </a>
            </div>
            <div class="btn">
                <a href="#" onclick="return false;">
                    <span>
                        <img src="/Content/img/btn/btn_del.gif" width="30" height="30" alt="Delete" /></span><p>삭제</p>
                </a>
            </div>
        </div>
    </div>
    <!--//리스트 하단버튼영역-->
    <!-- 버튼영역 종료 -->
}
